package com.cookor.poi.modules.weixin.utils;

import com.cookor.poi.modules.phy.entity.TOrder;
import com.xiaoleilu.hutool.json.JSONUtil;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description: TODO
 * @author: scott
 * @date: 2021年05月19日 16:35
 */
public class TempNoticeUtil {

    public static String getAppointSuccess(String tempId, TOrder order){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Map<String, Object> params = new ConcurrentHashMap<>();
            params.put("touser", order.getOpenId());
            params.put("template_id", tempId);
            params.put("url", "https://wdd.nthink.cn/phy/pages/AppointmentDetails/AppointmentDetails?siteid=" + order.getTenantId() + "&orderId=" + order.getId());
            Map<String, Object> data = new ConcurrentHashMap<>();
            Map<String, Object> value = new HashMap<>();
            value.put("value", "您好，您已预约成功。");
            data.put("first", value);
            value = new HashMap<>();
            value.put("value", order.getTenantName());
            data.put("keyword1", value);
            value = new HashMap<>();
            value.put("value", order.getOfficeName());
            data.put("keyword2", value);
            value = new HashMap<>();
            value.put("value", order.getDoctorName());
            data.put("keyword3", value);
            value = new HashMap<>();
            value.put("value", order.getPatientName());
            data.put("keyword4", value);
            value = new HashMap<>();
            value.put("value", sdf.format(order.getBookDate()) + " " + order.getBookDateDetail());
            data.put("keyword5", value);
            value = new HashMap<>();
            value.put("value", "如有任何疑问，请致电医院客服电话咨询。如需取消，请点击详情");
            data.put("remark", value);
            params.put("data", data);
            return JSONUtil.toJsonStr(params);

    }

    public static String getRetailSuccess(String tempId, TOrder order){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Map<String, Object> params = new ConcurrentHashMap<>();
            params.put("touser", order.getOpenId());
            params.put("template_id", tempId);
            params.put("url", "https://wdd.nthink.cn/phy/pages/AppointmentDetails/AppointmentDetails?siteid=" + order.getTenantId() + "&orderId=" + order.getId());
            Map<String, Object> data = new ConcurrentHashMap<>();
            Map<String, Object> value = new HashMap<>();
            value.put("value", "您好，您已报名成功。");
            data.put("first", value);
            value = new HashMap<>();
            value.put("value", order.getTenantName());
            data.put("keyword1", value);
            value = new HashMap<>();
            value.put("value", order.getOfficeName());
            data.put("keyword2", value);
            value = new HashMap<>();
            value.put("value", order.getDoctorName());
            data.put("keyword3", value);
            value = new HashMap<>();
            value.put("value", order.getPatientName());
            data.put("keyword4", value);
            value = new HashMap<>();
            value.put("value", sdf.format(order.getBookDate()) + " " + order.getBookDateDetail());
            data.put("keyword5", value);
            value = new HashMap<>();
            value.put("value", "报名时间结束后，若报名会人数达到最低要求，系统自动转为待就诊状态，若未达到最低人数，则报名失效");
            data.put("remark", value);
            params.put("data", data);
            return JSONUtil.toJsonStr(params);
    }

    public static String getAppointStop(String tempId, TOrder order){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Map<String, Object> params = new ConcurrentHashMap<>();
            params.put("touser", order.getOpenId());
            params.put("template_id", tempId);
            params.put("url", "https://wdd.nthink.cn/phy/pages/AppointmentDetails/AppointmentDetails?siteid=" + order.getTenantId() + "&orderId=" + order.getId());
            Map<String, Object> data = new ConcurrentHashMap<>();
            Map<String, Object> value = new HashMap<>();
            value.put("value", "很抱歉，接到医院通知，您预约的医生临时停诊，具体如下：");
            data.put("first", value);
            value = new HashMap<>();
            value.put("value", order.getTenantName());
            data.put("keyword1", value);
            value = new HashMap<>();
            value.put("value", order.getOfficeName());
            data.put("keyword2", value);
            value = new HashMap<>();
            value.put("value", order.getDoctorName());
            data.put("keyword3", value);
            value = new HashMap<>();
            value.put("value", order.getPatientName());
            data.put("keyword4", value);
            value = new HashMap<>();
            value.put("value", sdf.format(order.getBookDate()) + " " + order.getBookDateDetail());
            data.put("keyword5", value);
            value = new HashMap<>();
            value.put("value", "医院已经取消您的预约，请您重新挂号。");
            data.put("remark", value);
            params.put("data", data);
            return JSONUtil.toJsonStr(params);

    }


    public static String getAppointCancel(String tempId, TOrder order){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Map<String, Object> params = new ConcurrentHashMap<>();
            params.put("touser", order.getOpenId());
            params.put("template_id", tempId);
            params.put("url", "https://wdd.nthink.cn/phy/pages/AppointmentDetails/AppointmentDetails?siteid=" + order.getTenantId() + "&orderId=" + order.getId());
            Map<String, Object> data = new ConcurrentHashMap<>();
            Map<String, Object> value = new HashMap<>();
            value.put("value", "您好，您已成功取消预约挂号");
            data.put("first", value);
            value = new HashMap<>();
            value.put("value", order.getPatientName());
            data.put("keyword1", value);
            value = new HashMap<>();
            value.put("value", order.getTenantName());
            data.put("keyword2", value);
            value = new HashMap<>();
            value.put("value", order.getOfficeName());
            data.put("keyword3", value);
            value = new HashMap<>();
            value.put("value", order.getDoctorName());
            data.put("keyword4", value);
            value = new HashMap<>();
            value.put("value", sdf.format(order.getBookDate()) + " " + order.getBookDateDetail());
            data.put("keyword5", value);
            value = new HashMap<>();
            value.put("value", "具体详情请在微信公众号中查看");
            data.put("remark", value);
            params.put("data", data);
            return JSONUtil.toJsonStr(params);
    }

    public static String getAppointFail(String tempId, TOrder order){

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Map<String, Object> params = new ConcurrentHashMap<>();
            params.put("touser", order.getOpenId());
            params.put("template_id", tempId);
            params.put("url", "https://wdd.nthink.cn/phy/pages/AppointmentDetails/AppointmentDetails?siteid=" + order.getTenantId() + "&orderId=" + order.getId());
            Map<String, Object> data = new ConcurrentHashMap<>();
            Map<String, Object> value = new HashMap<>();
            value.put("value", "您好，您报名的拼好医活动已取消");
            data.put("first", value);
            value = new HashMap<>();
            value.put("value", order.getPatientName());
            data.put("keyword1", value);
            value = new HashMap<>();
            value.put("value", order.getTenantName());
            data.put("keyword2", value);
            value = new HashMap<>();
            value.put("value", order.getOfficeName());
            data.put("keyword3", value);
            value = new HashMap<>();
            value.put("value", order.getDoctorName());
            data.put("keyword4", value);
            value = new HashMap<>();
            value.put("value", sdf.format(order.getBookDate()) + " " + order.getBookDateDetail());
            data.put("keyword5", value);
            value = new HashMap<>();
            value.put("value", "由于活动报名人数未达到最低人数，故活动取消。");
            data.put("remark", value);
            params.put("data", data);
            return JSONUtil.toJsonStr(params);
    }


}
